#ifndef __TABLE_SCHEMA
#define __TABLE_SCHEMA

#define InvalidId -1

struct TopicCategory
{
    enum Enum
    {
        NoCategory = 0x0,
        Bible = 0x1,
        Teo = 0x2,
        Scientific = 0x4,
        Humanitarian = 0x8,
    };

    static QString toString( TopicCategory::Enum topicCategory )
    {
        switch (topicCategory)
        {
        case Bible:
            return QObject::tr( "Bible" );

        case Teo:
            return QObject::tr( "Teokratic" );

        case Scientific:
            return QObject::tr( "Scientific" );

        case Humanitarian:
            return QObject::tr( "Humanitarian" );

        default:
            return "";
        }
    }
};

struct IdTable
{
    QString tableName;
    qint64 currentId;

    IdTable()
    :   currentId( InvalidId )
    {
    }
};

struct QuestionStatus
{
    enum Enum
    {
        NotAnswered,
        Answering,
        BadAnswered,
        OkAnswered,
    };
};

struct Question
{
    qint64 id;
    qint64 topicId;
    QString question;
    QString answer;
    int value;
    QuestionStatus::Enum answered; // not in db

    Question()
    :   id( InvalidId ),
        topicId( InvalidId ),
        value( 0 ),
        answered( QuestionStatus::NotAnswered )
    {
    }

    bool operator==( const Question & otherQuestion ) const
    {
         return ( 
            id == otherQuestion.id &&
            topicId == otherQuestion.topicId &&
            question == otherQuestion.question &&
            answer == otherQuestion.answer &&
            value == otherQuestion.value &&
            answered == otherQuestion.answered );
    }

    bool operator!=( const Question & otherQuestion ) const
    {
        return ( ! ( * this == otherQuestion ) );
    }
};


struct Topic
{
    qint64 id;
    QString name;

    // moze byt vo viacerych kategoriach
    int category;
    QVector<Question> questionVector;

    Topic()
    :   id( InvalidId ),
        category( TopicCategory::NoCategory )
    {
    }

    bool operator==( const Topic & otherTopic ) const
    {
        return ( 
            id == otherTopic.id &&
            name == otherTopic.name &&
            category == otherTopic.category &&
            questionVector == otherTopic.questionVector );
    }

    bool operator!=( const Topic & otherTopic ) const
    {
        return ( ! ( * this == otherTopic ) );
    }
};

struct Player
{
    int id;
    QString name;
    int score;

    Player()
    :   id( 0 ),
        score( 0 )
    {
    }
};

#endif
